/*
 * @version: vue3
 * @Author: lxs
 * @Date: 2022-04-30 12:18:22
 * @LastEditors: sueRimn
 * @LastEditTime: 2022-04-30 15:50:32
 */
import { LoginParm, login } from "@/api/user/user";
// import { ElForm } from "element-plus";
import { reactive, ref } from "vue";
export default function useBaseLogin() {
  //获取表单的ref
  const loginFormRef = ref(null);
  // 定义数据
  const loginModel = reactive<LoginParm>({
    username: "",
    password: "",
    code: "",
  });
  // 表单校验
  const rules = reactive({
    username: [
      {
        required: true,
        message: "请输入名称",
        trigger: "blur",
      },
    ],
    password: [
      {
        required: true,
        message: "请输入密码",
        trigger: "blur",
      },
    ],
    code: [
      {
        required: true,
        message: "请输入验证码",
        trigger: "blur",
      },
    ],
  });
  return {
    loginFormRef,
    loginModel,
    rules,
  };
}
